#include<stdio.h>

int main()
{
    int n;
    double fac = 1.0;
    scanf("%d", &n);
    for(int i = 1; i <= n; i ++)
    {
        fac *= i;
        while(fac >= 10)
        {
            fac /= 10;
        }
    }
    printf("%d", (int)fac);
    return 0;
}